package com.zbxx.practice.socket;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author 万仁杰
 * @date 2019/05/30
 */
public class Server {


    public static void main(String[] args) throws IOException {
        ServerSocket server = new ServerSocket(8888);
        System.out.println("server is running");
        while (true){
            Socket socket = server.accept();
            BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
            System.out.println("客户端信息:"+reader.readLine());
            new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()))).write("哈哈");
        }

    }


}
